<template>
  <f7-page>
    <f7-navbar title="设置"></f7-navbar>
    <f7-block  v-if="isLogin" >
      <f7-button  @click="goOut" raised big fill>退出登录</f7-button>
    </f7-block>
    <f7-block  v-if="!isLogin" >
      <f7-button raised big fill @click="goLogin">去登陆</f7-button>
    </f7-block>
    <!--<div  v-if="!isLogin" @click="loginScreenOpened=true"></div>-->
    <!--<login-component :loginScreenOpened="loginScreenOpened" @funLogin="funLogin"></login-component>-->
  </f7-page>
</template>
<script>
  // import LoginComponent from '../components/loginComponent'

  export default {
    // components: {LoginComponent},
    data(){
      return{
        isLogin: sessionStorage.getItem('token')?true:false,
        // loginScreenOpened: false,
      }
    },
    created () {
      let self = this
      self.$bus.on('loginCallBack', function (bool) {
        self.isLogin = bool
      })
    },
    methods:{
      goLogin () {
        this.$bus.emit('loginDialog')
      },
      goOut(){
        this.isLogin = false
        sessionStorage.removeItem('token')
      }
    }
  }
</script>
